@extends('admin.layout')
@section('title')
	{{ $title }}
@endsection
@section('content')
	    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                分类管理
                <small>添加</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li><a href="#">分类管理</a></li>
                <li class="active">添加</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">快速添加分类</h3>
                        </div><!-- /.box-header -->
                        <!-- form start -->
                     @if (count($errors) > 0)
                      <div id="jg" class="callout callout-info">
                        <h4>警告</h4>
                        @foreach ($errors->all() as $error)
                        <p>{{ $error }}</p>
                        @endforeach
                      </div>
                       @endif
                        @if(session('info'))
                        <div id="jg" class="callout callout-info">
                        <h4>{{ session('info') }}</h4> 
                        </div>   
                        @endif 
                        <form role="form" action="{{ url('/admin/category/insert') }}" method="post" enctype="multipart/form-data">
                        	{{ csrf_field() }}
                            <div class="box-body">
                                 <div class="form-group">
                                    <label>父分类</label>
                                    <select name="pid" class="form-control">
                                        <option value="0">根分类</option>
                                        @foreach($data as $v)
                                        <option value="{{ $v -> id }}">{{ $v -> name}}</option>
                                        @endforeach
                                    </select>
                                </div>
                            	 <div class="form-group">
                                    <label for="exampleInputEmail1">子分类名</label>
                                    <input type="text" value="{{ old('name') }}" name="name" class="form-control" id="exampleInputName"
                                           placeholder="请输入分类名">
                                </div>
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">添加</button>
                                <button type="reset" class="btn btn-primary">重置</button>
                            </div>
                        </form>
                    </div><!-- /.box -->

                </div><!--/.col (left) -->
                <!-- right column -->
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
    <script type="text/javascript">
    	window.onload = function(){
    		setInterval(function(){
    			$('#jg').slideUp();
    		},3000);
    	}

    </script>
@endsection